<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title></title>
<link href="${base}/res/jeecore/css/admin.css" rel="stylesheet" type="text/css"/>
<link href="${base}/res/jeecore/css/theme.css" rel="stylesheet" type="text/css"/>
<link href="${base}/res/common/css/jquery.validate.css" rel="stylesheet" type="text/css"/>
<link href="${base}/res/common/css/jquery.treeview.css" rel="stylesheet" type="text/css"/>
<link href="${base}/res/common/css/pony.tree.css" rel="stylesheet" type="text/css"/>
<link href="${base}/res/common/css/jquery.ui.css" rel="stylesheet" type="text/css"/>
<link href="${base}/res/jspgou/css/product.css" rel="stylesheet" type="text/css"/>
<link href="${base}/res/jspgou/css/reset-min.css" rel="stylesheet" type="text/css"/>

<script src="${base}/thirdparty/ckeditor/ckeditor.js" type="text/javascript"></script>
<script src="${base}/thirdparty/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
<script src="${base}/res/common/js/jquery.js" type="text/javascript"></script>
<script src="${base}/res/common/js/jquery_ext.js" type="text/javascript"></script>
<script src="${base}/res/common/js/pony.js" type="text/javascript"></script>
<script src="${base}/res/common/js/pony.tree.js" type="text/javascript"></script>
<script src="${base}/res/jeecore/js/admin.js" type="text/javascript"></script>
<script src="${base}/res/jspgou/js/jquery.idTabs.min.js" type="text/javascript"></script>

<script src="${base}/res/common/js/lang/validator-${locale}.js" type="text/javascript"></script>

<script type="text/javascript">
$(function() {
	$("#jvForm").validate();
});
function checkReceiverUser(){
	if($("#username").val()==""&&$("#groupId").val()==-1){
		$("#usernameMsg").html("<@s.m 'cmsMessage.noSendUserError'/>");
	}else{
		$("#usernameMsg").html();
		$("#jvForm").submit();
	}
}
function find_user(){
	var username=$("#username").val();
	if(username!=""){
		$.post("v_findUser.do", {
			"username" : username
		}, function(data) {
			if(data.result==true){
				if(data.frontuser){
					$("#usernameMsg").html("不能给自己发站内信");
					$("#username").val("");
				}else if(data.exist){
					$("#usernameMsg").html("没有此用户");
					$("#username").val("");
				}else{
					$("#usernameMsg").html("");
				}
			}else if(data.result==false){
					alert("请先登录");
			}
		}, "json");
	}
}
</script>
</head>
<body>
<div class="box-positon">
	<div class="rpos"><@s.m "global.position"/>: <@s.m "cmsMessage.function"/> - <@s.m "cmsMessage.sendMessage"/></div>
	<form class="ropt">
		<input class="return-button" type="submit" value="<@s.m "global.backToList"/>" onclick="this.form.action='v_list.do?box=1';"/>
	</form>
	<div class="clear"></div>
</div>
<div class="body-box">
<@p.form id="jvForm" action="v_send.do" labelWidth="10">
<@p.td  label="cmsMessage.receiverUser" colspan="2" width="50">
<input  name="username" id="username" maxlength="100" onchange="find_user()" <#if message??>value="${message.username!}"</#if>/>
<@s.m "cmsMessage.groupSelect"/>
<select name="groupId" id="groupId">
  <option value="-1"><@s.m "cmsMessage.sendUserSelect"/></option>
  <option value="0"><@s.m "cmsMessage.allMember"/></option>
  <#list groupList as group>
  	 <option value="${group.id!}">${group.name!}</option>
  </#list>
</select>
<@s.m "cmsMessage.help"/>
<span style="color: red;" id="usernameMsg"></span>
</@p.td>
<@p.tr/>
<#if message??>
	<@p.text colspan="2" width="50" label="cmsMessage.title" name="msgTitle"  required="true" class="required" maxlength="100" value="${message.titleHtml!}" />
	<@p.tr/>
	<@p.textarea  style="width:90%;height:350px" wrap="off" maxlength="1024000"  label="cmsMessage.content" name="msgContent" value="${message.msgContent!}"/>
	<@p.tr/>
<#else>
	<@p.text colspan="2" width="50" label="cmsMessage.title" name="msgTitle"  required="true" class="required"  maxlength="100"/>
	<@p.tr/>
	<@p.textarea  style="width:90%;height:350px;word-wrap:break-word" maxlength="1024000"  label="cmsMessage.content" name="msgContent"/>
	<@p.tr/>
</#if>


<@p.td colspan="2"><@p.button code="global.submit" onclick="checkReceiverUser()" class="submit"/> &nbsp; <@p.reset code="global.reset"/></@p.td>

</@p.form>
</div>
</body>
</html>